<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<p v-color="'red'">{{msg}}</p>
		</div>
		<script type="text/javascript">
			let app = new Vue({
				el:"#app",
				data:{
					msg:"123456",
					red:""
				},
				directives:{
					color:function(el,binding){//el是绑定的元素对象，binding是指令对象
						console.log(binding.name)
						console.log(binding.value)
						console.log(binding.expression)
						// el.style.color=binding.expression
						el.style.color=binding.value
					}
				}
			})
		</script>
	</body>
</html>
